package com.macrounion.atv.processor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.macrounion.atv.service.entity.User;
import com.macrounion.atv.service.mapper.UserMapperExt;
import com.macrounion.atv.service.service.UserService;
import com.macrounion.base.processor.BaseProcessor;
import com.macrounion.base.service.exception.BusinessException;

@Component
public class UserProcessor extends BaseProcessor<User, User, UserService, User> {
    @Autowired
    private UserMapperExt userMapperExt;
    
	public User checkLogin(String account, String pwd) {
		User user = userMapperExt.findByAccount(account);
        if( user==null){
            throw new BusinessException(204, "账号不存在");
        }
        if (user.getPwd().equals(pwd)) {
        	user.setPwd("*******");
            return user;
        }
        throw new BusinessException(203, "账号或密码错误");
	}
}